﻿using System.Data;
using System.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using MySql.Data.MySqlClient;

namespace socialnetworkApp.Core
{
    public  static class DataBaseConfig
    {


        private static IConfiguration _configuration;
        public static void Initialize(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        #region mysql链接配置
        private static string DefaultSqlConnectionString = @"database=datahub;data source=127.0.0.1;user id=root;password=123456;";
  
        //private static ConnectionMultiplexer redis;

        public static IDbConnection GetSqlConnection(string sqlConnectionString = null)
        {
            if (string.IsNullOrWhiteSpace(sqlConnectionString))
            {
                sqlConnectionString = DefaultSqlConnectionString;
            }
            //配置mysql是MySqlConnection  配置其他数据库下载对应的包就好了，然后改掉这个连接对象
            IDbConnection conn = new MySqlConnection(sqlConnectionString);
            conn.Open();
            return conn;
        }

        #endregion

        #region Redis链接配置
     
        


        #endregion
    }
}
